package com.xyht.sca_s.student_manage_system.modules.meeting.controller;


import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.meeting.entity.req.SmsMeetingBuildingReq;
import com.xyht.sca_s.student_manage_system.modules.meeting.service.SmsMeetingBuildingService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 楼栋表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2023-08-03
 */
@RestController
@SecretBody
@RequestMapping("/meetingBuilding")
public class SmsMeetingBuildingController {
    @Resource
    private SmsMeetingBuildingService smsMeetingBuildingService;

    @ApiModelProperty(value = "添加楼栋")
    @PostMapping("/addBuilding")
    public ResponseResult addMeetingBuilding(@RequestBody SmsMeetingBuildingReq buildingReq) {
        return smsMeetingBuildingService.addMeetingBuilding(buildingReq);
    }

    @ApiModelProperty(value = "删除楼栋")
    @PostMapping("/deleteBuilding")
    public ResponseResult deleteMeetingBuilding(@RequestBody SmsMeetingBuildingReq idAdnTypeReq) {
        return smsMeetingBuildingService.deleteMeetingBuilding(idAdnTypeReq.getId(), idAdnTypeReq.getType());
    }

    @ApiModelProperty(value = "展示楼栋树")
    @GetMapping("/getBuildingTree")
    public ResponseResult getMeetingBuildingTree(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                                 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                                 @RequestParam(value = "name", required = false) String name) {
        return smsMeetingBuildingService.getMeetingBuildingTree(pageNum, pageSize, name);
    }
}

